package com.leetcode;

/**
 * 9. 回文数
 */
public class Solution9 {

    public boolean isPalindrome(int x) {
        String s = String.valueOf(x);
        int n = s.length();
        int p = 0;
        int q = n - 1;
        while (p < q) {
            if (s.charAt(p) != s.charAt(q)) {
                return false;
            }
            p++;
            q--;
        }
        return true;
    }

}
